# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=mauikit
pkgver=1.2.0
pkgrel=1
pkgdesc="Kit for developing MAUI Apps"
# armhf blocked by qt5-qtdeclarative
# mips64, s390x blocked by plasma-framework
arch="all !armhf !mips64 !s390x"
url="https://invent.kde.org/kde/mauikit"
license="GPL-2.0-or-later"
depends="kirigami2"
depends_dev="
	kconfig-dev
	kconfigwidgets-dev
	kdeclarative-dev
	kdecoration-dev
	ki18n-dev
	kio-dev
	knotifications-dev
	kservice-dev
	plasma-framework-dev
	qt5-qtbase-dev
	qt5-qtdeclarative-dev
	qt5-qtquickcontrols2-dev
	qt5-qtsvg-dev
	syntax-highlighting-dev
	"
makedepends="$depends_dev
	extra-cmake-modules
	"
source="https://invent.kde.org/maui/mauikit/-/archive/v$pkgver/mauikit-v$pkgver.tar.gz
	fix-compilation-with-master-kdecoration2.patch
	guard-against-correct-kdecoration-version.patch
	"
subpackages="$pkgname-dev"
builddir="$srcdir/$pkgname-v$pkgver"

prepare() {
	default_prepare

	# qmlplugindump fails for armv7+qemu (pmb#1970). This is purely for
	# packager knowledge and doesn't affect runtime, so we can disable it.
	if [ "$CARCH" = "armv7" ]; then
		sed -i "s/ecm_find_qmlmodule/# ecm_find_qmlmodule/g" CMakeLists.txt
	fi
}

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}
sha512sums="55795e332053b49edf4ea966ea19dbe804ba671587a6bf72e5cbe2f52acc5df0661235a4f38cf555a390c2701da1ddfa6ed6800576d385a72cd422996b1538a5  mauikit-v1.2.0.tar.gz
75bf24a91679ce07654ad2cbaa23494f95606cdceecc28765d180da71abbe85c688b18923ed86d49bb7c3f68ab859e87e7ac057057c338478f96ce1aa2aa6a69  fix-compilation-with-master-kdecoration2.patch
88bbdb35841609e69bd9a47191717d6ced52f983703b00e50d153fc07f8fa2bca7626ecfa9cca90539c5a8b07dab2ebc1b6498feb5600bc49e8a75a1275ee7b7  guard-against-correct-kdecoration-version.patch"
